package com.codewsq;

import java.io.PrintStream;
/*
*
*  调用method()方法后，控制台输出a=100，b=200
* */
public class ValueTransferTest1 {

    public static void main(String[] args) {
        int a = 10;
        int b = 10;
        method(a, b);
        System.out.println("a=" + a);
        System.out.println("b=" + b);
    }

    private static void method(int a, int b) {
        PrintStream printStream = new PrintStream(System.out) {
            @Override
            public void println(String x) {
                if ("a=10".equals(x)) {
                    x = "a=100";
                } else if ("b=10".equals(x)) {
                    x = "b=200";
                }
                super.println(x);
            }
        };

        System.setOut(printStream);
    }
}
